package com.company.service;

import com.company.entity.User;
import com.sun.xml.internal.bind.util.Which;

import java.util.Scanner;

public interface RegistService  extends StatrService{
    User user = new User();
    //实现登录
    Scanner sc=new Scanner(System.in);
    //所有跟用户相关

    //增加 add
    public static void print(){
        boolean falt=true;
        System.out.println("请输入用户名:");
        String admin;
        do {
            admin=sc.next();
            if(admin.length()>7){
                System.out.println("用户名不能超过7个字符");
                System.out.print("请重新输入：");
                falt=false;
            }else {
                user.setUsername(admin);
                falt=true;
            }
        }while (!falt);
        String pwd;
        do {
            System.out.println("请输入您的密码：");
            pwd=sc.next();
            if(pwd.length()<5){
                System.out.println("密码不能小于5个字符");
                System.out.print("请重新输入：");
                falt=false;
            }else if(pwd.equals("123456")){
                System.out.println("密码过于简单");
                System.out.print("请重新输入：");
                falt=false;
            }
            else {
                user.setPassword(pwd);
                falt=true;
            }
        }while (!falt);
        System.out.println("账号注册成功！");
    }

}
